<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2021/12/16
 * Time: 14:43
 */

namespace app\common\model;


use think\Model;
use traits\model\SoftDelete;

class BusInquiryDetailSupplier extends Model
{
    use SoftDelete;
    protected $deleteTime = 'delete_time';
    protected $hidden = ['delete_time'];

    protected $table='bus_inquiry_detail_supplier_company';

    protected $field = true;

    public function getQulityServicePriceAttr($val)
    {
        return $val?:0;
    }

    public function getQulityOrgPriceAttr($val)
    {
        return $val?:0;
    }

    public function getQulityMatchingPriceAttr($val)
    {
        return $val?:0;
    }

    public function getQulityCompletePriceAttr($val)
    {
        return $val?:0;
    }

    public function getQulitySuitablePriceAttr($val)
    {
        return $val?:0;
    }

    public function getQuoteQuiltyAttr($val)
    {
        return $val?explode(',',$val):[];
    }

    public function company()
    {
        return $this->belongsTo('SuppliersCompany','add_company_id','id')->bind('suppliers_company_name');
    }

    public function detail()
    {
        return $this->belongsTo('BusInquiryDetail','bus_inquiry_detail_id','id');
    }

    public function suppliersState()
    {
        return $this->belongsTo('BusInquirySuppliers','bus_inquiry_suppliers_id','id')->field('id,state as parent_state')->bind('parent_state');
    }
    public function detailCommon()
    {
        return $this->belongsTo('BusInquiryDetail','bus_inquiry_detail_id','id')->field('id,common as inquiry_common')->bind('inquiry_common');
    }
}